import requests
from bs4 import BeautifulSoup

# 登录参数
login_payload = {
    "phone": "17620084608",
    "login_pdw": "asd1234567",
    "sign": "7E941261FE6662EC5561F90762B2190B",
    "timestamp": 1702956948
}

# 签到URL
sign_url = "https://www.aimtes.xyz/api/v1/user/sign"

# 创建会话对象，保持会话状态
session = requests.Session()

# 发送登录请求
login_response = session.post("https://www.aimtes.xyz/api/v1/pwd_login", json=login_payload)

# 检查登录是否成功
if login_response.status_code == 200:
    # 发送签到请求
    sign_response = session.get(sign_url)

    # 检查签到是否成功
    if sign_response.status_code == 200:
        # 使用BeautifulSoup解析内容
        # soup = BeautifulSoup(sign_response.text, 'html.parser')

        # 在这里处理解析后的内容
        print("签到成功，响应内容:")
        print(sign_response.text)
        # print(soup.prettify())
    else:
        print(f"签到失败，状态码: {sign_response.status_code}")
        print("响应内容:")
        print(sign_response.text)
else:
    print(f"登录失败，状态码: {login_response.status_code}")
    print("响应内容:")
    print(login_response.text)
